include	<error.h>
include	<imio.h>

task datacube

procedure datacube()

pointer image,im
int imlist

int	imtopenp(),imtgetim()
pointer	immap()


begin

	call salloc (image, SZ_FNAME, TY_CHAR)

	imlist = imtopenp ("images")
	while (imtgetim (imlist, Memc[image], SZ_FNAME) != EOF) {
	    iferr {
			im = immap (Memc[image], READ_WRITE, 0)

#			iferr (call impstr (im, field, newval)) {
#				call eprintf ("cannot update %s,%s\n")
#				call pargstr (image)
#				call pargstr (field)
#				return
#			}

			iferr (call imputi (im, "i_naxis", 3)) {
				call eprintf ("cannot update %s,i_naxis\n")
				call pargstr (image)
				return
			}
			
			iferr (call imputi (im, "i_naxis2", 15)) {
				call eprintf ("cannot update %s,i_naxis2\n")
				call pargstr (image)
				return
			}

			iferr (call imaddi (im, "i_naxis3", 31)) {
				call eprintf ("cannot update %s,i_naxis3\n")
				call pargstr (image)
				return
			}



		} then {
			call erract (EA_WARN)
			next
	    }
		
		
	    call imunmap (im)
	}

end

